<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SysDepartment extends Model
{
    use HasFactory;

    protected $fillable = ['name', 'sort', 'status', 'parent_id'];

    public function children()
    {
        return $this->hasMany(SysDepartment::class, 'parent_id', 'id')->with(['children']);
    }
}
